import React, { forwardRef, useState } from 'react'
import { Form, Input, Select, InputNumber, DatePicker, Cascader } from 'antd'
import moment from "moment";
import city from "@/utils/citydata2"
import 'moment/locale/zh-cn'
const { Option } = Select
const UserForm = forwardRef((props, ref) => {
  var roleselect = ['超级管理员', '管理员', '用户']
  var sexselect = [
    { id: 0, roleName: '女' },
    { id: 1, roleName: '男' },
  ]
  const patient = ['健康', '冠心病', '高血压', '气管炎', '偏头痛', '感冒', '支气管扩张', '肺炎'];
  const [selectedItems, setSelectedItems] = useState([]);
  const filteredOptions = patient.filter((o) => !selectedItems.includes(o));
  return (
    <Form
      ref={ref}
      title="horizontal"
      key={ref.id}
      labelAlign="left"
    >
      <div className='frombox'>
        <Form.Item
          name="nickName"
          label="账号"
          rules={[{ required: true, message: '请输入账号' }]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          name="nickName"
          label="密码"
          rules={[{ required: true, message: '请输入密码' }]}
        >
          <Input type="password" />
        </Form.Item>
        <Form.Item
          name="title"
          label="姓名"
          rules={[{ required: true, message: '请输入姓名' }]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          name="addr"
          label="地址"
          rules={[{ required: true, message: '请输入地址' }]}
        >
          <Cascader options={city} placeholder="请输入地址" />
          {}
        </Form.Item>
        <Form.Item
          name="sex"
          label="性别"
          rules={[{ required: true, message: '请选择性别' }]}
        >
          <Select>
            {
              sexselect.map(item =>
                <Option value={item.id} key={item.id} >{item.roleName}</Option>
              )
            }
          </Select>
        </Form.Item>
        <Form.Item
          name="birth2"
          label="新增时间"
          rules={[{ required: true, message: '请选择新增时间' }]}
        >
          <DatePicker
            inputReadOnly
            allowClear
          />
        </Form.Item>
        <Form.Item
          name="birth3"
          label="修改时间"
          rules={[{ required: true, message: '请选择修改时间' }]}
        >
          <DatePicker
            inputReadOnly
            allowClear
          />
        </Form.Item>
      </div>
    </Form>
  )
})
export default UserForm